# 短信频率限制接口
from rest_framework.throttling import SimpleRateThrottle


class SMSThrottling(SimpleRateThrottle):
    scope = 'sms'

    def get_cache_key(self, request, view):
        telephone = request.query_params.get("telephone")
        # 'throttle_%(scope)s_%(ident)s'
        return self.cache_format%{"scope":self.scope, "ident": telephone}
